@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700&display=swap');

:root {
    --bg-color: #121212;
    --primary-color: #1e1e1e;
    --secondary-color: #2a2a2a;
    --accent-color: #6a82fb;
    --text-color: #e0e0e0;
    --text-muted-color: #888;
    --border-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background-color: #f4f7f9;
    color: #333;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 240px;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
}

.sidebar-nav li a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 10px;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-nav li a:hover, .sidebar-nav li a.active {
    background-color: #3498db;
    color: #ffffff;
}

.sidebar footer {
    margin-top: auto;
    text-align: center;
    font-size: 0.8em;
    color: #bdc3c7;
}

.content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
    background-color: #ffffff;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    color: #2c3e50;
}

/* 统一按钮样式 */
.upload-btn, .start-btn, .controls button, 
#download-model-btn, #set-model-btn, #upload-model-btn,
#select-image-btn, #predict-btn, 
#execute-sql-btn, #download-json-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s, transform 0.2s;
    margin-left: 10px;
    min-width: 120px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.upload-btn:hover, .start-btn:hover, .controls button:hover:not(:disabled),
#download-model-btn:hover, #set-model-btn:hover, #upload-model-btn:hover,
#select-image-btn:hover, #predict-btn:hover:not(:disabled),
#execute-sql-btn:hover, #download-json-btn:hover:not(:disabled) {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.upload-btn:disabled, .start-btn:disabled, .controls button:disabled,
#predict-btn:disabled, #download-json-btn:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* 特殊颜色的按钮 */
#download-model-btn, #set-model-btn {
    background-color: #16a085;
}

#download-model-btn:hover, #set-model-btn:hover {
    background-color: #117a65;
}

/* 文件选择器样式 */
.json-upload-input, #image-upload-input {
    display: none;
}

/* 模型选择下拉框样式 */
#model-select {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    margin-left: 10px;
    min-width: 220px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#model-select:hover {
    background-color: #2980b9;
}

#model-select option {
    background-color: white;
    color: #2c3e50;
    padding: 10px;
}

.status-area {
    background-color: #ecf0f1;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 25px;
    border-left: 5px solid #3498db;
}

.status-text {
    margin: 0;
    font-size: 1rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    max-width: 100%;
    overflow: hidden;
}

.chart-container {
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.chart-container canvas {
    max-width: 100% !important;
    height: 300px !important;
    width: 100% !important;
    display: block;
}

.chart-container h3 {
    margin-top: 0;
    text-align: center;
    color: #34495e;
}

.model-info-bar {
    background-color: #eafaf1;
    color: #2c3e50;
    padding: 12px 20px;
    border-radius: 5px;
    margin: -10px 0 25px 0;
    text-align: center;
    border: 1px solid #d4e9e2;
}

.model-info-bar p {
    margin: 0;
    font-size: 1rem;
}

.model-info-bar span {
    font-weight: bold;
    color: #16a085;
}

.model-management-area {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

/* User Test Section Styles */
.user-test-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.image-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px;
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    background-color: #fdfdfd;
    width: 100%;
    max-width: 500px;
}

#select-image-btn, #predict-btn {
    width: 150px;
}

#image-preview-container {
    margin-top: 15px;
    min-height: 200px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#prediction-result-container {
    text-align: center;
    padding: 20px;
    background-color: #ecf0f1;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
}

#prediction-result-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2980b9;
    margin: 10px 0 0 0;
}

/* 导航分隔线样式 */
.nav-divider {
    border-top: 1px solid #34495e;
    margin: 10px 0;
    padding: 0;
}

/* 生成JSON功能样式 */
.sql-input-container {
    margin: 20px 0;
}

.sql-input-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

#sql-input {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: #f8f9fa;
    color: #2c3e50;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#sql-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.json-result-container {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.json-result-container h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.json-preview {
    max-height: 300px;
    overflow-y: auto;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.json-info {
    margin-top: 10px;
    font-size: 14px;
    color: #7f8c8d;
    font-style: italic;
}

#execute-sql-btn, #download-json-btn {
    margin-right: 10px;
}

/* 响应式设计 - 图表容器在小屏幕上的适配 */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container canvas {
        height: 250px !important;
    }
}

@media (max-width: 768px) {
    .chart-container {
        padding: 15px;
    }
    
    .chart-container canvas {
        height: 200px !important;
    }
    
    .chart-container h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .charts-grid {
        gap: 15px;
    }
    
    .chart-container {
        padding: 10px;
    }
    
    .chart-container canvas {
        height: 180px !important;
    }
}
